import * as React from 'react'
import * as ReactDOM from 'react-dom'
import BaseRouter from './router/Router'
import { Provider } from 'react-redux'
import registerServiceWorker from './registerServiceWorker'
import StoreConfig from './redux/Store'
import Cache from './utils/cache'
import { Login } from './redux/actions/UserAction'
import './assets/fonts/iconfont/iconfont.css'
import './utils/enhance'
const store = StoreConfig()
if(Cache.sessionGet('LOGIN_USER')) {//判断token是否存在，如果存在，在每一个请求头上都加上
  store.dispatch(Login(Cache.sessionGet('LOGIN_USER')))
}

ReactDOM.render(
  <Provider store={store}>
    <BaseRouter/>
  </Provider>,
  document.getElementById('root') as HTMLElement
);
registerServiceWorker()